package com.itheima.controller;

import com.itheima.manager.CmsSubjectManager;
import com.itheima.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/subject")
public class CmsSubjectController {
    @Autowired
    CmsSubjectManager cmsSubjectManager;

    //获取全部商品专题
    @GetMapping("/listAll")
    public R findAllSubject(){
       return R.success( cmsSubjectManager.findAllSubject());
    }

    @GetMapping("/list")
    public R findSubjectList(
            @RequestParam(required = false)String keyword,
            @RequestParam(required = false)Integer pageNum,
            @RequestParam(required = false)Integer pageSize){
        return cmsSubjectManager.findSubjectList(keyword,pageNum,pageSize);
    }
}
